home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / quake_ad.zip / HIPQW.ZIP / SRC / HIPQUAKE.QC < prev    next >
Text File  |  1997-01-16  |  2KB  |  85 lines

  1. /* Earthquake QuickC program
  2.    By Jim Dose'  9/13/96
  3.    Copyright (c)1996 Hipnotic Interactive, Inc.
  4.    All rights reserved.
  5.    Do not distribute.
  6. */
  7. //JIM
  8. float       earthquake;
  9. float quakeactive;
  10.  
  11. void() StopEarthQuake =
  12.    {
  13.    earthquake = 0;
  14.    };
  15.  
  16. void( float value ) EarthQuakeTime =
  17.    {
  18.    value = value + time;
  19.    if ( value > earthquake )
  20.       {
  21.       earthquake = value;
  22.       }
  23.    };
  24.  
  25. void() earthquake_prethink =
  26.    {
  27. //   if ( lastearthquake )
  28. //      {
  29. //      self.view_ofs_z = self.savedz;
  30. //      lastearthquake = 0;
  31. //      }
  32.    };
  33.  
  34. void() earthquake_postthink =
  35.     {
  36.     if ( earthquake > time )
  37.         {
  38.       if (quakeactive == 0)
  39.          {
  40.          sound (self, CHAN_VOICE, "misc/quake.wav", 1, ATTN_NONE);
  41.          quakeactive = 1;
  42.          }
  43. //      lastearthquake = 1;
  44. //      self.savedz = self.view_ofs_z;
  45.         if ( self.flags & FL_ONGROUND )
  46.             {
  47. //         self.view_ofs_z = self.view_ofs_z - 5 + random() * 10;
  48.          self.velocity = self.velocity + (random() * '0 0 150');
  49.          }
  50.         }
  51.    else
  52.       {
  53.       if (quakeactive == 1)
  54.          {
  55.          sound (self, CHAN_VOICE, "misc/quakeend.wav", 1, ATTN_NONE);
  56.          quakeactive = 0;
  57.          }
  58.       }
  59.     };
  60.  
  61. void() earthquake_use =
  62.     {
  63.     EarthQuakeTime( self.dmg );
  64.     };
  65.  
  66. /*QUAKED func_earthquake (0 0 0.5) (0 0 0) (32 32 32)
  67. Causes an earthquake.  Triggers targets.
  68.  
  69. "dmg" is the duration of the earthquake.  Default is 0.8 seconds.
  70. */
  71.  
  72. void() func_earthquake =
  73.     {
  74.    quakeactive = 0;
  75.    precache_sound("misc/quake.wav");
  76.    precache_sound("misc/quakeend.wav");
  77.    self.classname = "earthquake";
  78.     self.use = earthquake_use;
  79.     self.think = SUB_Null;
  80.     if ( !self.dmg )
  81.        {
  82.        self.dmg = 0.8;
  83.        }
  84.     };
  85.